<?php
require_once('config.php');
require_once('lib/database.php');
require_once('lib/auth.php');
require_once('lib/user.php');




if(isset($_POST['submit'])){

	$check_auth = $auth->authenticate_user($_POST['username'] ,$_POST['password']);
	
	if($check_auth){
	
		session_start();
		$_SESSION['is_logged_in'] = TRUE;
		$_SESSION['username'] = $_POST['username'];
		
		header("Location: " . $config['base_url'] . "home.php");
	
	} else {
	
		$_SESSION['is_logged_in'] = FALSE;
	
	}

}


?>
<form method="post" action="login.php" >
<fieldset>
<legend accesskey="l">Login</legend>

<label for="username">Username :</label>
<input type="text" name="username" />
<label for="password">Password :</label>
<input type="password" name="password" />
<input type="submit" value="login" name="submit" />
<a href="signup.php">Sign Up</a>
</fieldset>

</form>
